{include file="public_head" /}

<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>

<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>

                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">

                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>优惠券会员卡详情</h2>

                                <div class="clearfix"></div>
                            </div>
                            <div class="x_content">
                                <form name="form" id="form" method="get" action="">
                                    <div class="title_left">
                                        <div class="col-md-{eq name='$auding_status' value="2"}7{else/}5{/eq} col-sm-3 col-xs-12 form-group pull-left top_search">
                                       <div class="input-group" style="float: left;margin: 0 20px;">

                                        <select name="status" class="select2_single" style="width: 200px;"
                                        tabindex="-1">
                                        <option value="0">- 会员卡状态 -</option>
                                        <option value="1" {eq name=':input("status")' value='1' }selected{/eq}>等待激活</option>
                                        <option value="2" {eq name=':input("status")' value='2' }selected{/eq}>已激活</option>
                                        <option value="3" {eq name=':input("status")' value='3' }selected{/eq}>禁止激活</option>
                                        </select>
                                        </div>

                                        {eq name="$auding_status" value="2"}
                                        <div class="input-group" style="float: left;margin: 0 20px;">

                                            <select name="salesman_id" id="status" class="select2_single" style="width: 300px;"
                                                    tabindex="-1">
                                                <option value="0">- 全部业务员 -</option>
                                                {volist name="$salesman" id="vo"}
                                                <option value="{$vo.manage_id}" {eq name=':input("salesman_id")' value='$vo.manage_id' }selected{/eq}>{neq name="$vo.parent_id" value="0"}{:str_repeat('&nbsp&nbsp&nbsp',$vo.level)}{/neq}|{:str_repeat('--',1)}{$vo.nickname}</option>
                                                {/volist}
                                            </select>
                                        </div>
                                        {/eq}
                                        <div class="input-group" style="float: left;margin: 0 20px;">
                                            <input type="text" class="form-control" name="interval_timer"
                                                   id="interval_timer"
                                                   style="width: 200px;"
                                                   placeholder="请选择时间区间..." value="{:input('interval_timer')}">
                                        </div>
                                    </div>
                                    <button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜 索</button>
                            </div>
                                    <table style="border-bottom:1px solid #ddd;"
                                           class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr class="success">
                                            <!--<th style="width: 2%; padding: 10px;">-->
                                                <!--<input type="checkbox" class="checkall"-->
                                                       <!--onclick="CheckAll(this.checked);"/>-->
                                            <!--</th>-->
                                            <!--<th>排序</th>-->
                                            <th width="30">ID</th>
                                            <th width="">业务员</th>
                                            <th width="">优惠券名称</th>
                                            <th width="">会员卡卡号</th>
                                            <th width="">激活码</th>
                                            <th width="">会员卡状态</th>
                                            <th width="">激活优惠券ID</th>
                                            <th width="">手机号</th>
                                            <th width="">激活时间</th>
                                            <th width="">创建日期</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {empty name="data"}
                                            <tr><td colspan="12"><div style='font-size:24px;margin:30px 0;'>没有找到记录</div></td></tr>
                                        {/empty}
                                        {volist name="data" id="vo" key="k"}
                                        <tr>
                                            <td>{$vo.g_id}</td>
                                            <td>{$vo.nickname}</td>
                                            <td>{$vo.title}</td>
                                            <td>{$vo.card_num}</td>
                                            <td>
                                                {eq name=":session('role_id')" value="1"}

                                                {$vo.card_password}

                                                {else/}
                                                {if condition="$vo.status eq 2"}
                                                {$vo.card_password}
                                                {else/}
                                                {:hideStr($vo['card_password'],0,14);}
                                                {/if}
                                                {/eq}
                                            </td>
                                            <td>
                                                {switch name="$vo.status" }
                                                {case 1}等待激活{/case}
                                                {case 2}已激活{/case}
                                                {case 3}禁止激活{/case}

                                                {/switch}
                                            </td>
                                            <td><a href="{:url('member_coupon/update', ['id' => $vo['order_id']])}">{$vo.order_id}</a></td>
                                            <td>{$vo.username}</td>
                                            <td>{$vo.jihuo_time}</td>
                                            <td>{$vo.create_time}</td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                    <div style="float: right;margin-top: -30px;">{$data->render()}</div>
                                    <button type="button" class="btn btn-success" >总数量: {$gift_count1+$gift_count2+$gift_count3} 张 等待激活: {$gift_count1} 张 已激活: {$gift_count2} 张 禁止激活: {$gift_count3} 张</button>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<!-- daterangepicker -->
<script src="__STATIC__/js/datepicker/daterangepicker.js"></script>
<!-- public -->
<script src="__STATIC__/js/public.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
<script type="text/javascript">
    // list
    $(document).ready(function () {
        // select2
        $(".select2_single").select2({
            placeholder: "请选择",
            allowClear: true
        });
        $(".select2_single1").select2({
            placeholder: "请选择",
            allowClear: true
        });
        // interval_timer
        $('#interval_timer').daterangepicker(null,
            function(start, end, label) {
//                console.log(start.toISOString(), end.toISOString(), label);
            });
    });

    //导出excel表格
    function dc(){
        var both = $('#interval_timer').val();
        var status = $('#status').val();

        if (both=='') {
            layer.msg('时间区间不能为空!');
            return;
        }if (status<0) {
            //layer.msg('订单状态不能为空!');
            //return;
        }

        var both_arr = both.split("/");
        console.log(both_arr);
        if (both_arr[0] == both_arr[1]){
            layer.msg('请选择时间区间为同1天!');
            return;
        }
        window.location.href = "{:url('daochu')}?interval_timer="+both+"&salesman_id="+status;
    }
</script>